package com.woniuxy.threadmethods;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO: interrupted 会清除标记
 * <P> Date: 2022/4/6:19:03
 * <P> Description:
 */
@Slf4j(topic = "c.Test14")
public class Test14 {
    static Object object = new Object();

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            log.debug("park");
            LockSupport.park();
            log.debug("unpark");
            //LockSupport.unpark();
            //log.debug("打断状态:{}", Thread.currentThread().isInterrupted());
            log.debug("打断状态:{}", Thread.interrupted());
            LockSupport.park();
            log.debug("unpark");
        }, "t1");

        thread.start();

        Thread.sleep(1000);
        thread.interrupt();
    }
}

